<?php
/**
 * @package css600
 * @version 0.1
 */
/*
Plugin Name: css600
Plugin URI: http://wordpress.org/extend/plugins/css600plugin/
Description: Test plugin.
Author: css 600 student
Version: 0.1
Author URI: http://uwb.edu/
*/

/*  Copyright YEAR  css 600 student  (email : lavinds@uw.edu)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License, version 2, as 
    published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

function displayDate() 
{
    echo "Title accessed on " . date(DATE_RFC822);
}

function boldFilter($input)
{
    // return "<b>" . $input . "</b>";
    return $input;
}

function endOfPage()
{
    echo "<!-- generated on " . date(DATE_RFC822) . "-->";
}
/*
Actions and filters are simply two different types of events. Wordpress refers events as hooks.

When you link one of your functions to a filter hook, your function must accept an input and 
return an output because it is intended to modify or "filter" output. 

When you link a function to an action hook, your function is not passed input parameters, 
and any value returned is simply ignored.
*/

// add_action('the_title', 'displayDate');

// http://codex.wordpress.org/Plugin_API/Filter_Reference
add_filter('the_title', 'boldFilter');

// http://codex.wordpress.org/Plugin_API/Action_Reference
add_action('shutdown', 'endOfPage');

// redirecting user if not logged in
// http://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect

// We can also hook to publishing of posts via publish_post action, input is post id
// others, e.g. comment_post
/*
NOTES: class based plugins

if(!class_exists('myplugin')) { 
    class myplugin { 
        public function __construct() { register functions }
        public static function activate() { ... }
        public static function deactivate() { ... }
        public function addHeaderCode() { ... e.g. css or js }
    } 
}

if (class_exists('myplugin')) 
{ 
    // Installation and uninstallation hooks 
    register_activation_hook(__FILE__, array('myplugin', 'activate')); 
    register_deactivation_hook(__FILE__, array('myplugin', 'deactivate')); 
    
    // instantiate the plugin class 
    $mypluginInstance = new myplugin(); 
}

if (isset($mypluginInstance)) {

    //Actions
    add_action('wp_head', array(&$mypluginInstance, 'addHeaderCode'), 1); // last parameter is priority

    //Filters
}

*/

// DATA validation
// http://codex.wordpress.org/Data_Validation

add_action( 'init', 'createcss600posttypes' );

function createcss600posttypes() {
	register_post_type( 'assignmententrypost', 
		array(
			'labels' => array(
				'name' => __( 'Assignment Entry' ),
				'singular_name' => __( 'Assignment Entry' ),
                'add_new' => __( 'Add New' ),
	            'add_new_item' => __( 'Add New Assignment Entry' ),
	            'edit' => __( 'Edit Assignment Entry' ),
	            'edit_item' => __( 'Edit Assignment Entry' ),
	            'new_item' => __( 'New Assignment Entry' ),
	            'view' => __( 'View Assignment Entry' ),
	            'view_item' => __( 'View Assignment Entry' ),
	            'search_items' => __( 'Search Assignment Entries' ),
	            'not_found' => __( 'No assignment entries found' ),
	            'not_found_in_trash' => __( 'No assignment entries found in Trash' ),
	            'parent' => __( 'Assignment' )
			),
            'description' => __( 'An assignment entry is submitted by students in a class.' ),
			'public' => true,
            'supports' => array( 'title', 'editor', 'thumbnail', 'comments' )
		)
	);
}

?>